import 'package:flutter/services.dart';

class AES{

  static const platform = const MethodChannel('com.bbtree.flutter/aes');

  static Future<String> encrypt(String key,String src) async{
    try {
      String result = await platform.invokeMethod('encrypt', {'key': key, 'src': src});
      return result;
    }catch(e){
      throw Exception("aes encrypt error");
    }
  }

  static Future<String> decrypt(String key,String src) async{
    try {
      String result = await platform.invokeMethod('decrypt', {'key': key, 'src': src});
      return result;
    }catch(e){
      throw Exception("aes encrypt error");
    }
  }

}